package com.tigercel.xiangchengyun.entity


import android.os.Parcel
import android.os.Parcelable

class NewsChannelTable() : Parcelable {

    var newsChannelName: String? = null
    var newsChannelId: String? = null
    var newsChannelType: String? = null
    var newsChannelSelect: Boolean = false
    var newsChannelIndex: Int = 0
    var newsChannelFixed: Boolean? = null

    constructor(parcel: Parcel) : this() {
        newsChannelName = parcel.readString()
        newsChannelId = parcel.readString()
        newsChannelType = parcel.readString()
        newsChannelSelect = parcel.readByte() != 0.toByte()
        newsChannelIndex = parcel.readInt()
        newsChannelFixed = parcel.readValue(Boolean::class.java.classLoader) as? Boolean
    }

    constructor(newsChannelName: String) : this() {
        this.newsChannelName = newsChannelName
    }

    constructor(newsChannelName: String, newsChannelId: String, newsChannelType: String, newsChannelSelect: Boolean, newsChannelIndex: Int, newsChannelFixed: Boolean?) : this() {
        this.newsChannelName = newsChannelName
        this.newsChannelId = newsChannelId
        this.newsChannelType = newsChannelType
        this.newsChannelSelect = newsChannelSelect
        this.newsChannelIndex = newsChannelIndex
        this.newsChannelFixed = newsChannelFixed
    }

    override fun writeToParcel(parcel: Parcel, flags: Int) {
        parcel.writeString(newsChannelName)
        parcel.writeString(newsChannelId)
        parcel.writeString(newsChannelType)
        parcel.writeByte(if (newsChannelSelect) 1 else 0)
        parcel.writeInt(newsChannelIndex)
        parcel.writeValue(newsChannelFixed)
    }

    override fun describeContents(): Int {
        return 0
    }

    companion object CREATOR : Parcelable.Creator<NewsChannelTable> {
        override fun createFromParcel(parcel: Parcel): NewsChannelTable {
            return NewsChannelTable(parcel)
        }

        override fun newArray(size: Int): Array<NewsChannelTable?> {
            return arrayOfNulls(size)
        }
    }


}
